package jdbc17;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class OracleDemo01
{
	public static final String DBDRIVER = "oracle.jdbc.driver.OracleDriver";
	public static final String DBURL = "jdbc:oracle:thin:@localhost:1521/oracle";
	public static final String DBUSER = "scott";
	public static final String DBPASS = "tiger";
	public static void main(String args[]) throws Exception
	{
		Connection conn = null;
		Class.forName(DBDRIVER);
		conn = DriverManager.getConnection(DBURL,DBUSER,DBPASS);
		String str = "insert into person(id,name,age,birthday) values(myseq.nextVal,?,?,?)";
		PreparedStatement ps = conn.prepareStatement(str);
		ps.setString(1, "刘兆清");
		ps.setInt(2, 26);
		ps.setDate(3, new java.sql.Date(new java.util.Date().getDate()));
		ps.executeUpdate();
		ps.close();
		conn.close();
		
	}
}
